package com.eight.paper.admin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.eight.common.annotation.Log;
import com.eight.common.core.controller.BaseController;
import com.eight.common.core.domain.AjaxResult;
import com.eight.common.enums.BusinessType;
import com.eight.paper.admin.domain.ExamPaperImage;
import com.eight.paper.admin.service.IExamPaperImageService;
import com.eight.common.utils.poi.ExcelUtil;
import com.eight.common.core.page.TableDataInfo;

/**
 * 考生镜像采集明细Controller
 * 
 * @author eight
 * @date 2024-05-04
 */
@Api(value = "考生镜像采集明细", tags = "考生镜像采集明细")
@RestController
@RequestMapping("/exam/image")
public class ExamPaperImageController extends BaseController
{
    @Autowired
    private IExamPaperImageService examPaperImageService;

    /**
     * 查询考生镜像采集明细列表
     */
    @ApiOperation(value = "查询考生镜像采集明细列表")
    @PreAuthorize("@ss.hasPermi('exam:image:list')")
    @GetMapping("/list")
    public TableDataInfo list(ExamPaperImage examPaperImage)
    {
        startPage();
        List<ExamPaperImage> list = examPaperImageService.selectExamPaperImageList(examPaperImage);
        return getDataTable(list);
    }

    /**
     * 导出考生镜像采集明细列表
     */
    @ApiOperation(value = "导出考生镜像采集明细列表")
    @PreAuthorize("@ss.hasPermi('exam:image:export')")
    @Log(title = "考生镜像采集明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ExamPaperImage examPaperImage)
    {
        List<ExamPaperImage> list = examPaperImageService.selectExamPaperImageList(examPaperImage);
        ExcelUtil<ExamPaperImage> util = new ExcelUtil<ExamPaperImage>(ExamPaperImage.class);
        util.exportExcel(response, list, "考生镜像采集明细数据");
    }

    /**
     * 获取考生镜像采集明细详细信息
     */
    @ApiOperation(value = "获取考生镜像采集明细详细信息")
    @PreAuthorize("@ss.hasPermi('exam:image:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(examPaperImageService.selectExamPaperImageById(id));
    }

    /**
     * 删除考生镜像采集明细
     */
    @ApiOperation(value = "删除考生镜像采集明细")
    @PreAuthorize("@ss.hasPermi('exam:image:remove')")
    @Log(title = "考生镜像采集明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(examPaperImageService.deleteExamPaperImageByIds(ids));
    }
}
